//
//  ButtonPageView.swift
//  SwiftUIDemo
//
//  Created by Kael on 2020/1/3.
//  Copyright © 2020 Kael. All rights reserved.
//

import SwiftUI

struct ButtonPageView: View {
    
    var activity = true
    
    
    var body: some View {
        NavigationView{
            VStack {
                        
                Button(action: {
                    print("++")
                }) {
                    HStack {
                        
                        Text("0")
                        .font(.system(size: 30))
                        .foregroundColor(Color.white)
                        .frame(width:176,height:88)
                        .background(Color.gray)
                        .cornerRadius(44)
                    
                    }

                    
                }
                
                Button(action: {
                    print("++")
                }) {
                    Text("=")
                        .font(.system(size: 30))
                        .foregroundColor(Color.white)
                        .frame(width:88,height:88)
                        .background(Color.orange)
                        .cornerRadius(44)
                    
                }
                
                NavigationLink(destination: SecureFieldView()) {
//                    CalculatorButton(title: "Nav")
                    Text("NavigationButton")
                        .foregroundColor(.green)
                        .padding(10)
                        .frame(width: 200, height: 100, alignment: .center)
                    .background(Color.black)
                }
                .navigationBarTitle(Text("ButtonPageView"))
                .navigationBarItems(trailing: EditButton())


            }
        }
    }
}

struct ButtonPageView_Previews: PreviewProvider {
    static var previews: some View {
        ButtonPageView()
    }
}

struct CalculatorButton: View {
    
    @State var title = "+"
    
    var body: some View {
        Button(action: {
            print("++")
        }) {
            Text(self.title)
                .font(.system(size: 30))
                .foregroundColor(Color.white)
                .frame(width:88,height:88)
                .background(Color.orange)
                .cornerRadius(44)
        }
    }
}
